const express = require('express');
const router = express.Router();
const auth = require('../middleware/auth');
const upload = require('../middleware/upload');
const userController = require('../controllers/userController');

// 需要认证的路由
router.use(auth);

// 获取用户资料
router.get('/profile', userController.getProfile);

// 更新用户资料
router.put('/profile', userController.updateProfile);

// 更新用户头像
router.put('/avatar', upload, userController.updateAvatar);

module.exports = router;